import { createApp } from 'vue';
// import App from './AppSetup.vue';
import App from './AppOption.vue';
// pinia
// import { createPinia } from 'pinia';
import { createPinia } from './pinia';
const pinia = createPinia();
pinia.use(function ({ store, pinia }) {
  // 持久化插件
  const state = localStorage.getItem('PINIA_STATE');
  if (state) {
    // 设置持久化
    store.$state = JSON.parse(state);
  }
  store.$subscribe((type, state) => {
    // 保存持久化
    localStorage.setItem('PINIA_STATE', JSON.stringify(state));
  })
  return {
    // 可以抛出公共方法
    xxx() {
      console.log("XXXXX")
    }
  }
});
const app = createApp(App);
app.use(pinia);
app.mount('#app');
